home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
L' Effet Pommier 3
/
L'Effet Pommier - Volume 03.iso
/
Programmation
/
Gooey1.3.1
/
C Templates
/
Events.c
< prev
next >
Wrap
Text File
|
1995-01-31
|
8KB
|
302 lines
$$Message User Events, u:events$Prototype.name$.h
$$File u:events$Prototype.name$.h
/* $CopyRight$ */
/* events$Prototype.name$ Additional event handler routines
File name: events$Prototype.name$.h
Function: This module contains the extra event handler routines
These routines allow us to override events in the main loop,
and to handle unique events.
History: $Date$ Original by $Author$
*/
/* ======================================================= */
/* ======================================================= */
#ifdef __cplusplus
extern "C" {
#endif
/* Handle the OS event */
void DoOSEvent(EventRecord *myEvent);
/* Handle special key combinations */
Boolean HandleKey(EventRecord *myevent);
/* Special disk inserted handling */
Boolean HandleDisk(EventRecord *myevent);
$$if HasZoomWindows
/* Handle our special Zooms */
void U_DoZoom(Rect *OldRect, WindowPtr whichWindow);
$$endif
$$if HasResizableWindows
/* Handle our special Grows */
void U_DoGrow(Rect *OldRect, WindowPtr whichWindow);
$$endif
/* Handle our special Moves */
void U_Moved(Rect *OldRect, WindowPtr whichWindow);
$$if HasGoAwayBoxes
/* Handle our special go aways */
void U_GoAway(WindowPtr whichWindow);
$$endif
/* Handle our special hits in our windows */
void U_InContent(EventRecord *myEvent, WindowPtr whichWindow);
/* Handle our special updates */
void U_Update(WindowPtr whichWindow);
/* Handle our special activates */
void U_Activate(WindowPtr whichWindow,Boolean Do_An_Activate);
/* Handle our special activates */
void U_EnableMenus(void);
/* Let us into the main loop */
void ApplLoop$Prototype.name$(void);
/* Filter events from the main loop */
void ApplEvent$Prototype.name$(Boolean *DoIt, EventRecord *myEvent);
/* Handle our special user events */
void Handle_UserEvent(UserEventRec *TheUserEvent);
#ifdef __cplusplus
}
#endif
/* ======================================================= */
/* ======================================================= */
$$CloseFile
$$Message User Events, u:events$Prototype.name$.c
$$File u:events$Prototype.name$.c
/* $CopyRight$ */
/* events$Prototype.name$ Additional event handler routines
File name: events$Prototype.name$.c
Function: This module contains the extra event handler routines
These routines allow us to override events in the main loop,
and to handle unique events.
History: $Date$ Original by $Author$
*/
#include "mmCommon$Prototype.name$.h" /* Common */
#include "Common$Prototype.name$.h" /* Common */
#include "events$Prototype.name$.h" /* This file */
#pragma segment MainHooks
/* ======================================================= */
/* Routine: AE_OpenThisFile */
/* Purpose: Called with files to be opened. Called both at program */
/* startup and during running. */
void AE_OpenThisFile(FSSpec *theFSSpec,short WhichFile,short TotalToOpen)
{
}
/* ======================================================= */
/* Routine: AE_PrintThisFile */
/* Purpose: Called with files to be printed. Called both at program */
/* startup and during running. */
void AE_PrintThisFile(FSSpec *theFSSpec,short WhichFile,short TotalToOpen)
{
}
/* ======================================================= */
/* Routine: DoOSEvent */
/* Purpose: Handle DoOSEvents */
void DoOSEvent(EventRecord *myEvent)
{
if (((myEvent->message & osEvtMessageMask) >> 24) == suspendResumeMessage)/* See which */
{
if ((myEvent->message & resumeFlag) == 0) /* Suspend */
InTheForeground = FALSE;
else
InTheForeground = TRUE;
}
}
/* ======================================================= */
/* Routine: HandleKey */
/* Purpose: Allow us to filter key strokes and special key combinations */
/* Return TRUE if we let the main loop handle the key stroke */
Boolean HandleKey(EventRecord *myevent)
{
short charCode; /* Key code */
char ch; /* Key pressed in Ascii */
Boolean CmdKeyPressed; /* Command key pressed */
Boolean OptionKeyPressed; /* Option key pressed */
Boolean ShiftKeyPressed; /* Shift key pressed */
Boolean theHandleKey; /* value to return */
theHandleKey = TRUE; /* Let the main loop handle it */
charCode = myevent->message & charCodeMask; /* Get the character */
ch = (char)charCode; /* Change it to ASCII */
CmdKeyPressed = ((myevent->modifiers & cmdKey) != 0); /* See if Command key is down */
OptionKeyPressed = ((myevent->modifiers & optionKey) != 0); /* See if Option key is down */
ShiftKeyPressed = ((myevent->modifiers & shiftKey) != 0); /* See if Shift key is down */
/* Add your code here */
return(theHandleKey); /* Return if we let main routine handle it */
}
/* ======================================================= */
/* Routine: HandleDisk */
/* Purpose: Allow us to handle disk inserted events specially */
/* Return TRUE if we let the main loop handle the key stroke */
Boolean HandleDisk(EventRecord *myevent)
{
Boolean theHandleDisk; /* value to return */
theHandleDisk = TRUE; /* Let the main loop handle it */
return(theHandleDisk); /* Return if we let main routine handle it */
}
$$if HasZoomWindows
/* ======================================================= */
/* Routine: U_DoZoom */
/* Purpose: Allow us in to handle it */
void U_DoZoom(Rect *OldRect, WindowPtr whichWindow)
{
}
$$endif
$$if HasResizableWindows
/* ======================================================= */
/* Routine: U_DoGrow */
/* Purpose: Allow us in to handle it */
void U_DoGrow(Rect *OldRect, WindowPtr whichWindow)
{
}
$$endif
/* ======================================================= */
/* Routine: U_Moved */
/* Purpose: Allow us in to handle it */
void U_Moved(Rect *OldRect, WindowPtr whichWindow)
{
}
$$if HasGoAwayBoxes
/* ======================================================= */
/* Routine: U_GoAway */
/* Purpose: Allow us in to handle it */
void U_GoAway( WindowPtr whichWindow)
{
}
$$endif
/* ======================================================= */
/* Routine: U_InContent */
/* Purpose: Allow us in to handle it */
void U_InContent(EventRecord *myEvent, WindowPtr whichWindow)
{
}
/* ======================================================= */
/* Routine: U_Update */
/* Purpose: Allow us in to handle it */
void U_Update(WindowPtr whichWindow)
{
}
/* ======================================================= */
/* Routine: U_Activate */
/* Purpose: Allow us in to handle it */
void U_Activate(WindowPtr whichWindow,Boolean Do_An_Activate)
{
}
/* ======================================================= */
/* Routine: U_EnableMenus */
/* Purpose: Allow us in to handle it */
void U_EnableMenus(void)
{
}
/* ======================================================= */
/* Routine: ApplLoop$Prototype.name$ */
/* Purpose: At the top of the main loop, called each time thru the main */
/* loop. This is very often if WNE was false. */
void ApplLoop$Prototype.name$(void)
{
}
/* ======================================================= */
/* Routine: ApplEvent$Prototype.name$ */
/* Purpose: Allow us to filter all events before the main loop handles them */
/* Set DoIt to TRUE to let the main loop handle the event. */
void ApplEvent$Prototype.name$(Boolean *DoIt, EventRecord *myEvent)
{
*DoIt = TRUE; /* Let the main loop handle it */
if (WNE) /* Check for mouse in cursor area available */
{
/* Check cursor region for possible cursor shape change, cursorRgn */
}
if (myEvent->what == 0) /* Handle a NULL event*/
*DoIt = FALSE; /* Tell the main loop to skip it*/
}
/* ======================================================= */
/* Routine: Handle_UserEvent */
/* Purpose: Handle our special user events */
void Handle_UserEvent(UserEventRec *TheUserEvent)
{
}
/* ======================================================= */
/* ======================================================= */
$$CloseFile